(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 8.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[      6204,        169]
NotebookOptionsPosition[      5748,        148]
NotebookOutlinePosition[      6086,        163]
CellTagsIndexPosition[      6043,        160]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell["MyPatternCompletion", "Title",
 CellChangeTimes->{{3.530310452678038*^9, 3.530310462764903*^9}},
 FormatType->"TextForm"],

Cell[BoxData[
 RowBox[{
  RowBox[{"InitStandardParameters", " ", ":=", " ", 
   RowBox[{"Module", "[", 
    RowBox[{
     RowBox[{"{", "}"}], ",", " ", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"x0", " ", "=", " ", "0.5"}], ";", 
      RowBox[{"(*", " ", 
       RowBox[{
        RowBox[{
        "average", " ", "valid", " ", "firing", " ", "rate", " ", "xt", " ", 
         "at", " ", "t"}], " ", "=", " ", "0"}], " ", "*)"}], 
      "\[IndentingNewLine]", 
      RowBox[{"y0", " ", "=", " ", "0.001"}], ";", " ", 
      RowBox[{"(*", " ", 
       RowBox[{
        RowBox[{
        "average", " ", "spurious", " ", "firing", " ", "rate", " ", "yt", 
         " ", "at", " ", "t"}], " ", "=", " ", "0"}], " ", "*)"}], " ", 
      "\[IndentingNewLine]", 
      RowBox[{"n", " ", "=", " ", "330000"}], ";", 
      RowBox[{"(*", " ", 
       RowBox[{"number", " ", "of", " ", "pyramdial", " ", "neuzrons"}], " ", 
       "*)"}], " ", "\[IndentingNewLine]", 
      RowBox[{"cBar", " ", "=", " ", "0.05"}], ";", " ", 
      RowBox[{"(*", " ", 
       RowBox[{"mean", " ", "connectivity"}], " ", "*)"}], " ", 
      "\[IndentingNewLine]", 
      RowBox[{"c2Bar", " ", "=", " ", "0.021"}], ";", " ", 
      RowBox[{"(*", " ", 
       RowBox[{
       "mean", " ", "squared", " ", "connection", " ", "probability"}], " ", 
       "*)"}], " ", "\[IndentingNewLine]", 
      RowBox[{"a", " ", "=", " ", "0.001"}], ";", " ", 
      RowBox[{"(*", " ", 
       RowBox[{"activity", ",", " ", 
        RowBox[{
         RowBox[{"i", ".", "e", ".", " ", "probability"}], " ", "that", " ", 
         "a", " ", "radomly", " ", "chosen", " ", "neuron", " ", "in", " ", 
         "a", " ", "memory", " ", "pattern", " ", "is", " ", "active"}]}], 
       " ", "*)"}], "\[IndentingNewLine]", 
      RowBox[{"m", " ", "=", " ", "200000"}], ";", " ", 
      RowBox[{"(*", " ", 
       RowBox[{
       "number", " ", "of", " ", "memories", " ", "stored", " ", "in", " ", 
        "the", " ", "network"}], " ", "*)"}], "\[IndentingNewLine]", 
      RowBox[{"g0", " ", "=", " ", 
       RowBox[{"7", " ", 
        SuperscriptBox["10", 
         RowBox[{"-", "6"}]]}]}], ";", 
      RowBox[{"(*", " ", 
       RowBox[{"threshold", " ", "parameter"}], " ", "*)"}], " ", 
      "\[IndentingNewLine]", 
      RowBox[{"g1", " ", "=", " ", "0.024"}], ";", " ", 
      RowBox[{"(*", " ", 
       RowBox[{"strength", " ", "of", " ", "inhibition"}], " ", "*)"}], " ", 
      "\[IndentingNewLine]", 
      RowBox[{"\[Sigma]N", " ", "=", " ", "0.0"}], ";"}]}], " ", 
    RowBox[{"(*", " ", 
     RowBox[{"no", " ", "synaptic", " ", "noise"}], " ", "*)"}], " ", 
    "\[IndentingNewLine]", "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.5026297979570203`*^9, 3.5026298212527027`*^9}, {
  3.5026304197376833`*^9, 3.502630453345338*^9}, {3.502631581974559*^9, 
  3.502631583755763*^9}, {3.502636733890129*^9, 3.5026367355462837`*^9}, {
  3.5028073069419994`*^9, 3.502807451740728*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"analyze", "[", 
    RowBox[{"nValid_", ",", " ", "nSpurious_"}], "]"}], " ", ":=", " ", 
   RowBox[{"Module", "[", 
    RowBox[{
     RowBox[{"{", "}"}], ",", " ", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"s", " ", "=", " ", 
       RowBox[{"nValid", " ", "+", " ", "nSpurious"}]}], ";", 
      "\[IndentingNewLine]", 
      RowBox[{"r0", " ", "=", 
       RowBox[{"If", "[", 
        RowBox[{
         RowBox[{"s", " ", ">", " ", "0"}], ",", "  ", 
         FractionBox[
          RowBox[{"nValid", " ", "-", " ", 
           RowBox[{"a", " ", "s"}]}], 
          RowBox[{
           SqrtBox[
            RowBox[{"s", " ", 
             RowBox[{"(", 
              RowBox[{"1", "-", 
               RowBox[{"s", "/", "n"}]}], ")"}]}]], 
           SqrtBox[
            RowBox[{"n", " ", "a", " ", 
             RowBox[{"(", 
              RowBox[{"1", " ", "-", " ", "a"}], ")"}]}]]}]], ",", " ", "0"}],
         "]"}]}], " ", ";", "\[IndentingNewLine]", "r0"}]}], 
    "\[IndentingNewLine]", "]"}]}], ";", 
  RowBox[{
   RowBox[{"analyze", "::", "usage"}], " ", "=", " ", 
   "\"\<Analyzes the result table produced by update. Syntax: analyze[x_]. \
Returns {nValid, nSpurious, r0}\>\""}], ";"}]], "Input",
 CellChangeTimes->{{3.5027919617763166`*^9, 3.502792140113242*^9}, {
   3.5027921786078844`*^9, 3.5027921795561633`*^9}, {3.502792264212734*^9, 
   3.502792268432623*^9}, {3.5027922989054728`*^9, 3.5027923103121605`*^9}, {
   3.5027924766759033`*^9, 3.502792478394543*^9}, 3.502795454108385*^9, {
   3.5027956361974087`*^9, 3.502795678172653*^9}, {3.529230674270034*^9, 
   3.5292306921634626`*^9}, {3.530314151610759*^9, 3.53031418118636*^9}, {
   3.530314223627921*^9, 3.530314244822353*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"analyze", "[", 
  RowBox[{"165", ",", "330"}], "]"}]], "Input",
 CellChangeTimes->{{3.530314184170165*^9, 3.53031420462572*^9}}],

Cell[BoxData["0.4075329745620187`"], "Output",
 CellChangeTimes->{{3.530314205301364*^9, 3.530314249499613*^9}}]
}, Open  ]]
}, Open  ]]
},
WindowSize->{740, 655},
WindowMargins->{{Automatic, 158}, {Automatic, 56}},
FrontEndVersion->"8.0 for Linux x86 (32-bit) (February 23, 2011)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[579, 22, 127, 2, 88, "Title"],
Cell[709, 26, 2955, 65, 282, "Input"],
Cell[3667, 93, 1761, 41, 208, "Input"],
Cell[CellGroupData[{
Cell[5453, 138, 152, 3, 30, "Input"],
Cell[5608, 143, 112, 1, 30, "Output"]
}, Open  ]]
}, Open  ]]
}
]
*)

(* End of internal cache information *)

